var aes=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[0].getElementsByTagName("a");
var sections=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section");
var spans=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[2].getElementsByTagName("span");
var h6s=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[2].getElementsByTagName("h6");
var sectiona1=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[1].getElementsByTagName("a");
var sectiona2=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[2].getElementsByTagName("a");
var sectiona3=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[3].getElementsByTagName("a");
var sectiona4=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[4].getElementsByTagName("a");
var sectiona5=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("section")[5].getElementsByTagName("a");
var sectionas=document.getElementsByClassName("kz_condition")[0].getElementsByTagName("a");
var articalsection=document.getElementsByTagName("article")[0].getElementsByTagName("section")[2].getElementsByTagName("a");
for(var i=0;i<aes.length;i++){
   EventUtil.addHandler(aes[i],"click",function(event){

		var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<aes.length;j++){
	    	aes[j].style.backgroundColor="white";
	    	aes[j].style.color="black";
	    }

	    _target.style.backgroundColor="#ff8a44";
	    _target.style.color="white";
	   for(var l=3;l<sectionas.length;l++){
	    	sectionas[l].style.color="rgba(0,0,0,.8)";
	    }
	     for(var l=0;l<spans.length;l++){
	    	spans[l].style.color="rgba(0,0,0,.8)";
	    }
	    
	   if(_target.innerHTML=="写字楼"){
	   	sections[3].style.display="block";
	   	sections[4].style.display="block";
	   	sections[5].style.display="block";
	   	sections[5].style.display="none";
	   }else if(_target.innerHTML=="工位"){
	   	sections[3].style.display="block";
	   	sections[4].style.display="block";
	   	sections[5].style.display="block";
	   	sections[4].style.display="none";
	   }else{
	   	sections[3].style.display="block";
	   	sections[4].style.display="block";
	   	sections[5].style.display="block";
	   	sections[3].style.display="none";
	   }

});
}
for(var i=0;i<spans.length;i++){
	 EventUtil.addHandler(spans[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<spans.length;j++){
	    	spans[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="#ff8a44";
	    if(_target.innerHTML=="空间"){
	       h6s[0].style.display="block";
	       h6s[1].style.display="none";	
	    }else{
	    	 h6s[0].style.display="none";
	       h6s[1].style.display="block";	
	    }
	 });

}

for(var i=0;i<sectiona1.length;i++){
	 EventUtil.addHandler(sectiona1[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<sectiona1.length;j++){
	    	sectiona1[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="#ff8a44";
	 });

}
for(var i=0;i<sectiona2.length;i++){
	 EventUtil.addHandler(sectiona2[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<sectiona2.length;j++){
	    	sectiona2[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="#ff8a44";
	 });

}
for(var i=0;i<sectiona3.length;i++){
	 EventUtil.addHandler(sectiona3[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<sectiona3.length;j++){
	    	sectiona3[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="#ff8a44";
	 });

}
for(var i=0;i<sectiona4.length;i++){
	 EventUtil.addHandler(sectiona4[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<sectiona4.length;j++){
	    	sectiona4[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="#ff8a44";
	 });

}
for(var i=0;i<sectiona5.length;i++){
	 EventUtil.addHandler(sectiona5[i],"click",function(event){
        var _event=EventUtil.getEvent(event);
	    var _target=EventUtil.getTarget(_event);
	    for(var j=0;j<sectiona5.length;j++){
	    	sectiona5[j].style.color="rgba(0,0,0,.8)";
	    }
	    _target.style.color="rgba(65,24,200,.8)";
	 });

}
for(var i=1;i<articalsection.length-1;i++){
	
	EventUtil.addHandler(articalsection[i],"click",function(event){
		var _event=EventUtil.getEvent(event);
		var _target=EventUtil.getTarget(_event);
		for(var j=1;j<articalsection.length;j++){
			articalsection[j].style.color="rgba(0,0,0,.7)";
			articalsection[j].style.border="1px solid rgba(0,0,0,.3)";

		}
		_target.style.color="rgba(0,0,0,1)";
	    _target.style.border="1px solid rgba(65,45,200,.7)";

	});


}
//排序
var orders=document.getElementsByClassName("order");
for(var i=0;i<orders.length;i++){
	EventUtil.addHandler(orders[i],"click",function(event){
		var _event=EventUtil.getEvent(event);
		var target=EventUtil.getTarget(_event);
		for(var j=0;j<orders.length;j++){
			orders[j].style.color="rgba(0,0,0,.7)";
		}
		target.style.color="#ff8a44";
	});
}
//排序调价删除
var cancels=document.getElementsByClassName("cancel");
var order_top=document.getElementsByClassName("kz_order_top")[0];
for(var i=0;i<cancels.length;i++){
	EventUtil.addHandler(cancels[i],"click",function(event){
		var _event=EventUtil.getEvent(event);
		var target=EventUtil.getTarget(_event);
		console.log(target.parentNode);
		order_top.removeChild(target.parentNode);
		
	});
}
